perm filename DVITYP.DIF[WEB,ALS]1 blob
sn#669322 filedate 1982-07-16 generic text, type T, neo UTF8
1) DVITYP.WEB[PAS,DEK] and 2) DVITYP.WEB[WEB,ALS] 7-16-82 15:39 pages 1,1
**** File 1) DVITYP.WEB[PAS,DEK]/3P/34L
1) gets modified.
1) @d banner=='This is DVItype, Version 0' {printed when the program starts}
1) @ This program is written in standard \PASCAL, except where it is necessary
**** File 2) DVITYP.WEB[WEB,ALS]/3P/34L
2) gets modified. We will also allow othercases as noted in \.{TANGLE}.
2) @↑system dependencies@>
2) @d banner=='This is DVItype, Version 0' {printed when the program starts}
2) @d othercases == others: {default for cases not listed explicitly}
2) @d endcases == @+end {follows the default case in an extended |case| statement}
2) @f othercases == else
2) @f endcases == end
2) @ This program is written in standard \PASCAL, except where it is necessary
***************
**** File 1) DVITYP.WEB[PAS,DEK]/7P/80L
1) @!in_width:array[0:255] of integer; {\.{TFM} width data in \.{DVI} units}
1) @!tfm_check_sum:integer; {check sum found in |tfm_file|}
**** File 2) DVITYP.WEB[WEB,ALS]/7P/80L
2) @!in_width:array[0..255] of integer; {\.{TFM} width data in \.{DVI} units}
2) @!tfm_check_sum:integer; {check sum found in |tfm_file|}
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/92L
1) @d fin_set=41 {label for commands that set or put a character}
**** File 2) DVITYP.WEB[WEB,ALS]/10P/92L
2) But first we will need to split off a part of |do_page| to reduce its
2) size. We will call this portion |function do_others| and we will make a
2) reasonable attempt to place the less used commands in it although we will
2) not try to separate w0 from w1, w2, w3, and w4, nor y0 from y1, etc..
2) We will also find it convenient to define as global certain variables
2) that are used in both |do_page| and |do_others|.
2) @<Glob...@>=
2) @!cur_font:integer; {current internal font number}
2) @!showing:boolean; {is the current command being translated in full?}
2) @ We wuii use the following labels.
2) @d fin_set=41 {label for commands that set or put a character}
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/100L
1) @p function do_page:boolean;
1) label fin_set,fin_rule,move_right,move_down,show_state,change_font,
1) done,9998,9999;
**** File 2) DVITYP.WEB[WEB,ALS]/10P/114L
2) @ And now for |function do_others|.
2) @p function do_others(o:eight_bits;p:integer;a:integer):boolean;
2) label change_font,move_down,9998,done;
2) var
2) @!q:integer; {parameters of the current command}
2) @!k:integer; {loop index}
2) @!bad_char:boolean; {has a non-ascii character code appeared in this |xxx|?}
2) begin
2) @<Start the |do_others| translation and go to the appropriate label@>
2) move_down: @<Finish a command that sets |v←v+p|, then |goto done|@>;
2) change_font: @<Finish a command that changes the current font@>;
2) 9998: do_others←false;
2) done: end;
2) @ Now we are ready to consider |do_page| itself.
2) @p function do_page:boolean;
2) label fin_set,fin_rule,move_right,show_state,
2) done,9998,9999;
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/108L
1) @!cur_font:integer; {current internal font number}
1) @!k:integer; {loop index}
1) @!showing:boolean; {is the current command being translated in full?}
1) @!bad_char:boolean; {has a non-ascii character code appeared in this |xxx|?}
1) begin cur_font←nf; {set current font undefined}
**** File 2) DVITYP.WEB[WEB,ALS]/10P/140L
2) begin cur_font←nf; {set current font undefined}
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/146L
1) move_down: @<Finish a command that sets |v←v+p|, then |goto done|@>;
1) show_state: @<Show the values of |ss|, |h|, |v|, |w|, |x|, |y|, |z|,
1) |hh|, and |vv|; then |goto done|@>;
1) change_font: @<Finish a command that changes the current font@>;
1) done: if showing then print_ln(' ');
**** File 2) DVITYP.WEB[WEB,ALS]/10P/174L
2) show_state: @<Show the values of |ss|, |h|, |v|, |w|, |x|, |y|, |z|,
2) |hh|, and |vv|; then |goto done|@>;
2) done: if showing then print_ln(' ');
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/163L
1) four_cases(put1): begin major('put',o-put1+1:0,' ',p:0); goto done;
1) end;
1) put_rule: begin major('putrule'); goto fin_rule;
**** File 2) DVITYP.WEB[WEB,ALS]/10P/189L
2) put_rule: begin major('putrule'); goto fin_rule;
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/168L
1) @t\4@>@<Cases for horizontal and vertical motion@>@;
1) sixty_four_cases(fnt_num_0): begin major('fntnum',p:0);
**** File 2) DVITYP.WEB[WEB,ALS]/10P/192L
2) @t\4@>@<Cases for horizontal motion@>@;
2) othercases if do_others(o,p,a) then goto done else goto 9998;
2) end
2) @ @<Start the |do_others| translation...@>=
2) case o of
2) four_cases(put1): begin major('put',o-put1+1:0,' ',p:0); goto done;
2) end;
2) @t\4@>@<Cases for vertical motion@>@;
2) sixty_four_cases(fnt_num_0): begin major('fntnum',p:0);
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/183L
1) end
1) @ @<Cases for |nop|, |bop|, $\ldotss$, |pop|@>=
**** File 2) DVITYP.WEB[WEB,ALS]/10P/215L
2) end;
2) @ @<Cases for |nop|, |bop|, $\ldotss$, |pop|@>=
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/224L
1) Vertical motion is done similarly, but with the threshold between
1) ``small'' and ``large'' increased by a factor of five. The idea is to make
1) fractions like ``$1\over2$'' round consistently, but to absorb accumulated
1) rounding errors in the baseline-skip moves.
1) @d out_space(#)==if abs(p)≥font_space[cur_font] then
**** File 2) DVITYP.WEB[WEB,ALS]/10P/257L
2) @d out_space(#)==if abs(p)≥font_space[cur_font] then
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/234L
1) @d out_vmove(#)==if abs(p)≥5*font_space[cur_font] then vv←pixel_round(v+p)
1) else vv←vv+pixel_round(p);
1) major(#,' ',p:0); goto move_down
1) @<Cases for horizontal and vertical motion@>=
1) four_cases(right1):begin out_space('right',o-right1+1:0);
**** File 2) DVITYP.WEB[WEB,ALS]/10P/263L
2) @<Cases for horizontal motion@>=
2) four_cases(right1):begin out_space('right',o-right1+1:0);
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/245L
1) four_cases(down1):begin out_vmove('down',o-down1+1:0);
**** File 2) DVITYP.WEB[WEB,ALS]/10P/271L
2) @ Vertical motion is done similarly, but with the threshold between
2) ``small'' and ``large'' increased by a factor of five. The idea is to make
2) fractions like ``$1\over2$'' round consistently, but to absorb accumulated
2) rounding errors in the baseline-skip moves.
2) @d out_vmove(#)==if abs(p)≥5*font_space[cur_font] then vv←pixel_round(v+p)
2) else vv←vv+pixel_round(p);
2) major(#,' ',p:0); goto move_down
2) @<Cases for vertical motion@>=
2) four_cases(down1):begin out_vmove('down',o-down1+1:0);
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/264L
1) end
**** File 2) DVITYP.WEB[WEB,ALS]/10P/300L
2) goto done;
2) end
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/361L
1) end;
1) goto done
1) @ @<Finish a command that changes the current font@>=
**** File 2) DVITYP.WEB[WEB,ALS]/10P/398L
2) end
2) @ @<Finish a command that changes the current font@>=
***************
**** File 1) DVITYP.WEB[PAS,DEK]/10P/369L
1) end
1) @* Finding the postamble and the starting page.
**** File 2) DVITYP.WEB[WEB,ALS]/10P/405L
2) end;
2) goto done
2) @* Finding the postamble and the starting page.
***************
**** File 1) DVITYP.WEB[PAS,DEK]/12P/104L
1) @!default_directory:packed array[1:default_directory_name_length] of char;
1) @ @<Set init...@>=
**** File 2) DVITYP.WEB[WEB,ALS]/12P/104L
2) @!default_directory:packed array[1..default_directory_name_length] of char;
2) @ @<Set init...@>=
***************
**** File 1) DVITYP.WEB[PAS,DEK]/12P/126L
1) if r+4>name_length then abort('Font name is too long!')
1) @.Font name is too long@>
**** File 2) DVITYP.WEB[WEB,ALS]/12P/126L
2) if r+4>name_length then abort('Font name is too long!');
2) @.Font name is too long@>
***************